import json

import requests

"""
状态码
    401:未授权
    403:
    404:(page not found)
"""

# response = requests.get('https://www.baidu.com')
# print(response.status_code)

# # get请求 请求ajax接口
# response = requests.get("https://www.httpbin.org/get")
# # json反序列化
# json_str = response.content.decode()
# py_obj = json.loads(json_str)
# print(py_obj["origin"])
# # 反序列化封装简化操作
# print(response.json()["origin"])

# get请求  请求图片资源并保存  https://www.pexels.com/zh-cn/

# get请求  请求媒体资源并保存  https://www.douyin.com/
response = requests.get(
    "https://v2-zj-hnct.kwaicdn.com/bs2/photo-video-mz/5225301631612134078_68f259a0266d1173_1999_hd15.mp4?tag=1-1750045225-unknown-0-2nee1h5vgs-105854b917f427db&provider=self&clientCacheKey=3xpqfm5nzb2m5v9_f21e4e94&di=7ba0e139&bp=10004&Aecs=172.17.4.205&ocid=100000983&tt=hd15&ss=vpm")
with open("video.mp4", "wb") as f:
    f.write(response.content)

# get请求  请求word,pdf,excel等文件资源并保存  http://ggzy.zwfwb.tj.gov.cn/jyxx/index.jhtml
